// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SolutionExtensions.cs" company="Roman '4ux-nbIx' Novitsky">
//   Copyright (c) Roman '4ux-nbIx' Novitsky 2009
// </copyright>
// <summary>
//   Defines the SolutionExtensions type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace SettingsManager
{
  #region Namespace Imports

  using System.Globalization;
  using System.IO;

  using JetBrains.ProjectModel;

  using Properties;

  #endregion


  /// <summary>
  /// Defines <see cref="ISolution"/> class extension methods.
  /// </summary>
  internal static class SolutionExtensions
  {
    #region Public Methods

    /// <summary>
    /// Gets the name of the solution settings file.
    /// </summary>
    /// <param name="solution">
    /// The solution.
    /// </param>
    /// <returns>
    /// An instance of <see cref="System.String"/>.
    /// </returns>
    public static string GetSettingsFileName(this ISolution solution)
    {
      return string.Format(
        CultureInfo.InvariantCulture, 
        "{0}.{1}", 
        solution.SolutionFilePath.NameWithoutExtension, 
        Resources.SettingsFileExtension);
    }


    /// <summary>
    /// Gets the solution settings file path.
    /// </summary>
    /// <param name="solution">
    /// The solution.
    /// </param>
    /// <returns>
    /// The solution settings file path.
    /// </returns>
    public static string GetSettingsFilePath(this ISolution solution)
    {
      return Path.Combine(solution.SolutionFilePath.Directory.FullPath, GetSettingsFileName(solution));
    }

    #endregion
  }
}